package com.daqian.chance.example.dynamic.datasource.modules.db1.service.impl;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqian.chance.common.constant.WebCommonConstant;
import com.daqian.chance.example.dynamic.datasource.modules.db1.mapper.MemberMapper;
import com.daqian.chance.example.dynamic.datasource.modules.db1.po.dto.MemberDTO;
import com.daqian.chance.example.dynamic.datasource.modules.db1.po.entity.Member;
import com.daqian.chance.example.dynamic.datasource.modules.db1.service.IMemberService;
import com.daqian.chance.example.dynamic.datasource.modules.db2.mapper.Demo3Mapper;
import com.daqian.chance.example.dynamic.datasource.modules.db2.po.entity.Demo3;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 * 用户-信息 服务实现类
 * </p>
 * @author daqian
 * @since 2019-07-25
 */
@Service
@Slf4j
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements IMemberService {
    @Resource
    private MemberMapper memberMapper;

    @Resource
    private Demo3Mapper demo3Mapper;

    @Override
    public List<Member> page(MemberDTO memberDTO) {
        step1();
        step2();
        return null;
    }

    @Override
    public void step1() {
        List<Member> members = memberMapper.querAll();
        int i = memberMapper.updateTest();
        System.out.println(members);
        System.out.println(i);
    }

    @Override
    @DS("db2")
    public void step2() {
        List<Demo3> demo3s = demo3Mapper.querAll();
        System.out.println(demo3s);
    }

}
